package
{
	import flare.display.TextSprite;
	
	import flash.display.*;
	
	public class Octagon extends Sprite
	{
		private var step1:Number;
		private var step2:Number;
		
		public function Octagon(txt:String, step:int)
		{
			this.step1 = step;
			this.step2 = step1 * Math.SQRT1_2;
			//Math.SQRT1_2;
			//Math.SQRT2;

			this.visible = true;
			this.graphics.beginFill(0x33cccc);
			this.graphics.lineStyle(2, 0x009999);
			this.graphics.moveTo(0, step1 + 2 * step2);
			this.graphics.lineTo(step2, step1 + step2);
			this.graphics.lineTo(step2, step2);
			this.graphics.lineTo(step2 + step1, step2);
			this.graphics.lineTo(step1 + 2 * step2, 0);
			this.graphics.lineTo(step1 + 3 * step2, step2);
			this.graphics.lineTo(2 * step1 + 3 * step2, step2);
			this.graphics.lineTo(2 * step1 + 3 * step2, step2 + step1);
			this.graphics.lineTo(2 * step1 + 4 * step2, step1 + 2 * step2);
			this.graphics.lineTo(2 * step1 + 3 * step2, step1 + 3 * step2);
			this.graphics.lineTo(2 * step1 + 3 * step2, 2 * step1 + 3 * step2);
			this.graphics.lineTo(step1 + 3 * step2, 2 * step1 + 3 * step2);
			this.graphics.lineTo(step1 + 2 * step2, 2 * step1 + 4 * step2);
			this.graphics.lineTo(step1 + step2, 2 * step1 + 3 * step2);
			this.graphics.lineTo(step2, 2 * step1 + 3 * step2);
			this.graphics.lineTo(step2, step1 + 3 * step2);
			this.graphics.lineTo(0, step1 + 2 * step2);
			this.graphics.endFill();
			
			var text:TextSprite = new TextSprite(txt);
			text.x = 15;
			text.y = 13;
			text.size = 20;
			text.color = 0xFFFFFF;
			this.addChild(text);
		}
	}
}